const CryptoJS = require('./../plug/aes.js'); //引用AES源码js
const key = CryptoJS.enc.Utf8.parse("12345678900000001234567890000000"); //十六位十六进制数作为秘钥
const iv = CryptoJS.enc.Utf8.parse('1234567890000000'); //十六位十六进制数作为秘钥偏移量

/**
 * aes 加密方法
 */
function AesEncrypt(word) {
	let srcs = CryptoJS.enc.Utf8.parse(JSON.stringify(word));
	let encrypted = CryptoJS.AES.encrypt(srcs, key, {
		iv: iv,
		mode: CryptoJS.mode.CBC,
		padding: CryptoJS.pad.Pkcs7
	});
	return encrypted.ciphertext.toString();

}

//暴露接口
module.exports = {
	AesEncrypt
}
